#if !defined(NODE_H)
#define NODE_H

#include "nodetype.h"
#include <string>
using namespace std;

namespace gunsmith
{
class CSceneGraph;
class CResourceManager;
/*! \class CNode
	\brief Base class for all types that derive from node. */
class CNode
{
friend class CSceneGraph;

public:
					CNode				(ENODETYPE eType);
	virtual			~CNode				();
	void			AddChild			(CNode* pNewChild);
	void			AddSibbling			(CNode* pNewSibbling);
	virtual void	Draw				();
	virtual void	DrawDebug			();
	CNode*			GetFirstChild		()											const;
	const char*		GetName				()											const;
	CNode*			GetNextSibbling		()											const;
	CNode*			GetParent			()											const;
	CNode*			GetPrevSibbling		()											const;
	ENODETYPE		GetNodeType			()											const;
	void			PrintNodeStructure	(CNode *pNodeBase, std::string sIndention)	const;
	void			Remove				(CNode **ppNode);
	void			SetName				(const string& sName);
	void			SetSceneGraph		(CSceneGraph *pSceneGraph);
	virtual void	Update				(float fDelta, void *pData = NULL);

protected:
	CNode				*m_pFirstChild;
	CNode				*m_pNextSibbling;
	CNode				*m_pPrevSibbling;
	CNode				*m_pParent;
	ENODETYPE			m_eNodeType;
	string				m_sName;
	CResourceManager	*m_pResMngr;
	CSceneGraph			*m_pSceneGraph;

private:
	CNode*	GetLastSibbling() const;
	void	RemoveRecursive(CNode *pNode);
};
};

#endif  //NODE_H
